//
//  HLMatchUserCell.m
//  YueYue
//
//  Created by hulu001 on 2023/6/6.
//

#import "HLMatchUserCell.h"

@interface HLMatchUserCell ()

@property (nonatomic, strong) UIView *leftView;
@property (nonatomic, strong) UIView *rightView;
@property (nonatomic, strong) UIImageView *avatarView;
@property (nonatomic, strong) UIImageView *coverView;
@property (nonatomic, strong) UILabel *nicknameLabel;
@property (nonatomic, strong) UILabel *selfSignLabel;
@end

@implementation HLMatchUserCell


-(instancetype)initWithFrame:(CGRect)frame{
    
    if ([super initWithFrame:frame]) {
        [self setupView];
    }
    return self;
    
}

- (void)setupView {
    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = 8;
    
    self.backgroundColor = [HLMainColor colorWithAlphaComponent:0.7];
    
    self.avatarView = [[UIImageView alloc] init];
    _avatarView.contentMode = UIViewContentModeScaleAspectFill;
    _avatarView.layer.masksToBounds = YES;
    _avatarView.layer.cornerRadius = 8;
    [self.contentView addSubview:_avatarView];
    [_avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(UIEdgeInsetsMake(3, 3, 3, 3));
    }];
    
    self.leftView = [[UIView alloc] init];
    _leftView.backgroundColor = HLMainColor;
    _leftView.layer.masksToBounds = YES;
    _leftView.layer.cornerRadius = 6;
    [self.contentView addSubview:_leftView];
    [_leftView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(12);
        make.top.mas_equalTo(20);
        make.left.mas_equalTo(10);
    }];
    
    
    self.rightView = [[UIView alloc] init];
    _rightView.backgroundColor = HLMainColor;
    _rightView.layer.masksToBounds = YES;
    _rightView.layer.cornerRadius = 6;
    [self.contentView addSubview:_rightView];
    [_rightView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(12);
        make.top.mas_equalTo(20);
        make.right.mas_equalTo(-10);
    }];
    
    self.coverView = [[UIImageView alloc] initWithImage:UIImageMake(@"home_flow_cover")];
    [self.contentView addSubview:_coverView];
    [_coverView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
    }];

    self.selfSignLabel = [[UILabel alloc] qmui_initWithFont:UIFontMake(12) textColor:[UIColorWhite colorWithAlphaComponent:0.6]];
    _selfSignLabel.text = @"蹲下来是为了跳得更高";
    [self.contentView addSubview:_selfSignLabel];
    [_selfSignLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(12);
        make.bottom.right.mas_equalTo(-12);
    }];

    self.nicknameLabel = [[UILabel alloc] qmui_initWithFont:UIFontMediumMake(14) textColor:UIColorWhite];
    _nicknameLabel.text = @"123";
    [self.contentView addSubview:_nicknameLabel];
    [_nicknameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(_selfSignLabel);
        make.bottom.equalTo(_selfSignLabel.mas_top).offset(-4);
    }];
}

- (void)setModel:(HLHomeListModel *)model
{
    _model = model;
    [_avatarView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[HLUIHelper avatarBigPlaceholder]];
    _selfSignLabel.text = model.selfSign;
    _nicknameLabel.text = [NSString stringWithFormat:@"%@ . %@岁",model.nickname, model.age];
}


@end
